#!/bin/bash
#information
#author: gr.cn 
#email: 920098699@qq.com
#date: Mon Jun  3 20:21:48 CST 2013
#function:　删除用户，步骤如下：
#1.获得要删除用户账户的正确账户名
#2.强制终止正在运行属于该用户的进程
#3.确认系统属于该账户的所有文件
#4.删除用户
get_answer(){
	ASK_COUNT=1
	unset ANSWER
	while [ -z "$ANSWER" ]
	do
		case $ASK_COUNT in
		1)
			echo "the first time to read"
			;;
		2)
			echo "the sencond time to read"
			;;
		3)
			echo "the last time to read"
			;;
		4)
			echo "error input over 3 times"
			echo "the script going to exit..."
			exit 1
			;;
		esac
	
		ASK_COUNT=$[$ASK_COUNT + 1]
		echo $LINE1
		echo -e $LINE2
		read -t 60 ANSWER 
	done 
}

process_answer(){
	case $ANSWER in
		y|Y|YES|YEs|YeS|Yes|yES|yEs|yeS|yes)
	
		;;
	
		*)
			echo $EXIT_LINE1
			echo $EXIT_LINE2
		;;
	esac
}
LINE1="Please input the name of the user"
LINE2="the account you want to delete from the system:"
get_answer
USER_ACCOUNT=$ANSWER
LINE1="Is $USER_ACCOUNT is the account"
LINE2="you wish to delete?[y/N]"
EXIT_LINE1="Because $USER_ACCOUNT is not the account"
EXIT_LINE2="you want to delete. we are leaving the script..."
process_answer
